﻿@model SeguriGasesERP.Models.OrdenDeCompra

@{
    ViewBag.Title = "Create";
}

<h2>Create</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    @Html.HiddenFor(model => model.ID)
    @Html.HiddenFor(model => model.FechaGenerada)
    @Html.HiddenFor(model => model.Activa)
    <fieldset>
        <legend>OrdenDeCompra</legend>

        <div class="editor-label">
            <label for="IdSucursal">Sucursal</label>
        </div>

        <div class="editor-field">
            @Html.DropDownList("IdSucursal", new SelectList(ViewBag.Sucursales as System.Collections.IEnumerable, "ID", "Nombre"))
        </div>

        <div class="editor-label">
            <label for="IdProveedor">Proveedor</label>
        </div>

        <div class="editor-field">
            @Html.DropDownList("IdProveedor", new SelectList(ViewBag.Proveedores as System.Collections.IEnumerable, "ID", "RazonSocial"))
        </div>
    </fieldset>
    <fieldset>
    <table>
        <tr>
            <th>Cantidad</th>
            <th>Producto</th>
        </tr>
        @for (int i = 0; i < ViewBag.noProductos; i++)
        {
         <tr>
            <td>
                <input type="text" name="cantidadProducto@(i + 1)" />
            </td>
            <td>
               @Html.DropDownList("IdProducto" + (i + 1), new SelectList(ViewBag.Productos as System.Collections.IEnumerable, "ID", "Nombre"))
            </td>
         </tr>
        }
    </table>
        <p>
            <input type="hidden" name="noProductos" value="@ViewBag.noProductos" />
           
               <input type="submit" value="Create" />
     
        </p>

    </fieldset>
    
}

<div>
    @Html.ActionLink("Regresar a la Lista", "Index")
</div>

